<%@page import="databank.DataBankVo"%>
<%@page import="java.util.Vector"%>
<%@page import="databank.DataBank"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>list.jsp</title>
<style>
#list_serial,#list_irum,#list_jemok,#list_mdate{
	display:inline-block;
	background-color:#bbffcc;
}
.item_serial, .item_irum, .item_jemok, .item_mdate{
	display:inline-block;
}
#list_serial,#list_irum,.item_serial,.item_irum{
	width:80px;
}
#list_jemok,.item_jemok{
	width:200px;
}
#list_mdate, .item_mdate{
	width:140px;
}
#Cnt{
	width:300px;
}
#write{
	margin-left:435px;
}
#Cnt,#find_div{
	display:inline-block;
}
#list_main{
	width:710px;
	margin:auto;
	margin-top:30px;
}
</style>
<script>

function getId(id){ return document.getElementById(id)}
function init(){
	getId('btnfind').onclick=findFunc;
	getId('find').onkeyup=function(ev){
		if(ev.keyCode == 13) findFunc;
	}
	getId('write').onclick=function(){
		location.href='MyHome.jsp?inc_content=./databank/upload_form.jsp';
	}
}
function findFunc(){
	var find = getId('find').value;
	location.href='MyHome.jsp?inc_content=./databank/list.jsp&find='+find;
}

</script>
</head>
<body>
<jsp:useBean id="bankVo" class="databank.DataBankVo" scope="page"/>
<%
bankVo.setRequest(request);
DataBank bank = new DataBank();
bank.setVo(bankVo);
Vector<DataBankVo> v = bank.filelist(); 

%>


<div id='list_main'>
<h1>파일 리스트</h1>

<div id='Cnt'>
<label>총게시글수 : <%=v.size() %> </label>
<output id='bookCnt'>

</output>
</div>
<div id='find_div'>
	<input type='search' id='find'  name='find' value='<%=bankVo.getFind()%>'>
	<input type='button' id='btnfind' value='검색'>

</div>



<div id='list_body'>
	<div id='list_title'>
		<div id='list_serial'>파일번호</div>
		<div id='list_jemok'>제목</div>
		<div id='list_irum'>올린사람</div>
		<div id='list_mdate'>날짜</div>
	</div>
	<%
	for(int i=0; i<v.size() ; i++){ 
		DataBankVo dv = v.get(i);
	
	%>
	<div class='list_item'>
		<div class='item_serial'><%=dv.getSerial()%></div>
		<div class='item_jemok'><a href='MyHome.jsp?inc_content=./databank/view.jsp&serial=<%=dv.getSerial()%>'><%=dv.getSubject()%></a></div>
		<div class='item_irum'><%=dv.getMid()%></div>
		<div class='item_mdate'><%=dv.getMdate()%></div>
	</div>
	<%} %>
</div>
<p/>
<input type='button' id='write' value='파일업로드'>
</div>
<script>init();</script>
</body>
</html>